<script setup>
import { useStore } from 'vuex'
const store = useStore()
//点击切换index
const emits = defineEmits(['closePopup'])
const changeIndex = (index) => {
  store.commit('category/setCurrentIndex', index)
  emits('closePopup')
}
</script>
<template>
  <ul>
    <li class="p-2 text-2xl">所有类目</li>
    <li
      class="p-2"
      v-for="(item, index) in $store.getters.categorys"
      :key="index"
      @click="changeIndex(index)"
    >
      {{ item.name }}
    </li>
  </ul>
</template>

<style lang="scss" scoped></style>
